home *** CD-ROM | disk | FTP | other *** search
/ Aminet 45 / Aminet 45 (2001)(GTI - Schatztruhe)[!][Oct 2001].iso / Aminet / gfx / x11 / x3270_3_2_16.lha / amiga_src / apl.c < prev    next >
C/C++ Source or Header  |  2008-10-18  |  6KB  |  197 lines

  1. /*
  2.  * Copyright 1993, 1994, 1995, 1999, 2000 by Paul Mattes.
  3.  *  Permission to use, copy, modify, and distribute this software and its
  4.  *  documentation for any purpose and without fee is hereby granted,
  5.  *  provided that the above copyright notice appear in all copies and that
  6.  *  both that copyright notice and this permission notice appear in
  7.  *  supporting documentation.
  8.  */
  9.  
  10. /*
  11.  *    apl.c
  12.  *        This module handles APL-specific actions.
  13.  */
  14.  
  15. #include "globals.h"
  16.  
  17. #if defined(X3270_APL) /*[*/
  18.  
  19. #include <X11/keysym.h>
  20.  
  21. #include "aplc.h"
  22.  
  23.  
  24. /*
  25.  * APL keysym translation.
  26.  *
  27.  * This code looks a little odd because of how an APL font is implemented.
  28.  * An APL font has APL graphics in place of the various accented letters and
  29.  * special symbols in a regular font.  APL keysym translation consists of
  30.  * taking the keysym name for an APL symbol (these names are meaningful only to
  31.  * x3270) and translating it into the keysym for the regular symbol that the
  32.  * desired APL symbol _replaces_.
  33.  *
  34.  * For example, an APL font has the APL "jot" symbol where a regular font has
  35.  * the "registered" symbol.  So we take the keysym name "jot" and translate it
  36.  * into the keysym XK_registered.  When the XK_registered symbol is displayed
  37.  * with an APL font, it appears as a "jot".
  38.  *
  39.  * The specification of which APL symbols replace which regular symbols is in
  40.  * IBM GA27-3831, 3174 Establishment Controller Character Set Reference.
  41.  *
  42.  * In addition, several standard characters have different names for APL,
  43.  * for example, "period" becomes "dot".  These are included in the table as
  44.  * well.
  45.  */
  46.  
  47. static struct {
  48.     const char *name;
  49.     KeySym keysym;
  50.     int is_ge;
  51. } axl[] = {
  52.     { "Aunderbar",        XK_nobreakspace,    1 },
  53.     { "Bunderbar",        XK_acircumflex,        1 },
  54.     { "Cunderbar",        XK_adiaeresis,        1 },
  55.     { "Dunderbar",        XK_agrave,        1 },
  56.     { "Eunderbar",        XK_aacute,        1 },
  57.     { "Funderbar",        XK_atilde,        1 },
  58.     { "Gunderbar",        XK_aring,        1 },
  59.     { "Hunderbar",        XK_ccedilla,        1 },
  60.     { "Iunderbar",        XK_ntilde,        1 },
  61.     { "Junderbar",        XK_eacute,        1 },
  62.     { "Kunderbar",        XK_ecircumflex,        1 },
  63.     { "Lunderbar",        XK_ediaeresis,        1 },
  64.     { "Munderbar",        XK_egrave,        1 },
  65.     { "Nunderbar",        XK_iacute,        1 },
  66.     { "Ounderbar",        XK_icircumflex,        1 },
  67.     { "Punderbar",        XK_idiaeresis,        1 },
  68.     { "Qunderbar",        XK_igrave,        1 },
  69.     { "Runderbar",        XK_ssharp,        1 },
  70.     { "Sunderbar",        XK_Acircumflex,        1 },
  71.     { "Tunderbar",        XK_Adiaeresis,        1 },
  72.     { "Uunderbar",        XK_Agrave,        1 },
  73.     { "Vunderbar",        XK_Aacute,        1 },
  74.     { "Wunderbar",        XK_Atilde,        1 },
  75.     { "Xunderbar",        XK_Aring,        1 },
  76.     { "Yunderbar",        XK_Ccedilla,        1 },
  77.     { "Zunderbar",        XK_Ntilde,        1 },
  78.     { "alpha",        XK_asciicircum,        1 },
  79.     { "bar",        XK_minus,        0 },
  80.     { "braceleft",        XK_braceleft,        1 },
  81.     { "braceright",        XK_braceright,        1 },
  82.     { "bracketleft",    XK_Yacute,        1 },
  83.     { "bracketright",     XK_diaeresis,        1 },
  84.     { "circle",        XK_cedilla,        1 },
  85.     { "circlebar",        XK_Ograve,        1 },
  86.     { "circleslope",    XK_otilde,        1 },
  87.     { "circlestar",        XK_Ugrave,        1 },
  88.     { "circlestile",    XK_ograve,        1 },
  89.     { "colon",        XK_colon,        0 },
  90.     { "comma",        XK_comma,        0 },
  91.     { "commabar",        XK_W,            1 }, /* soliton */
  92.     { "del",        XK_bracketleft,        1 },
  93.     { "delstile",        XK_udiaeresis,        1 },
  94.     { "delta",        XK_bracketright,    1 },
  95.     { "deltastile",        XK_ugrave,        1 },
  96.     { "deltaunderbar",    XK_Udiaeresis,        1 },
  97.     { "deltilde",        XK_Ucircumflex,        1 },
  98.     { "diaeresis",        XK_Ecircumflex,        1 },
  99.     { "diaeresiscircle",    XK_V,            1 }, /* soliton */
  100.     { "diaeresisdot",    XK_Odiaeresis,        1 },
  101.     { "diaeresisjot",    XK_U,            1 }, /* soliton */
  102.     { "diamond",        XK_oslash,        1 },
  103.     { "dieresis",        XK_Ecircumflex,        1 },
  104.     { "dieresisdot",    XK_Odiaeresis,        1 },
  105.     { "divide",        XK_onehalf,        1 },
  106.     { "dot",        XK_period,        0 },
  107.     { "downarrow",        XK_guillemotright,    1 },
  108.     { "downcaret",        XK_Igrave,        1 },
  109.     { "downcarettilde",    XK_ocircumflex,        1 },
  110.     { "downshoe",        XK_questiondown,    1 },
  111.     { "downstile",        XK_thorn,        1 },
  112.     { "downtack",        XK_ETH,            1 },
  113.     { "downtackjot",    XK_Uacute,        1 },
  114.     { "downtackup",        XK_onesuperior,        1 },
  115.     { "downtackuptack",    XK_onesuperior,        1 },
  116.     { "epsilon",        XK_sterling,        1 },
  117.     { "epsilonunderbar",    XK_Iacute,        1 },
  118.     { "equal",        XK_equal,        0 },
  119.     { "equalunderbar",    XK_backslash,        1 },
  120.     { "euro",        XK_X,            1 }, /* soliton */
  121.     { "greater",        XK_greater,        0 },
  122.     { "iota",        XK_yen,            1 },
  123.     { "iotaunderbar",    XK_Egrave,        1 },
  124.     { "jot",        XK_registered,        1 },
  125.     { "leftarrow",        XK_currency,        1 },
  126.     { "leftbracket",    XK_Yacute,        1 },
  127.     { "leftparen",        XK_parenleft,        0 },
  128.     { "leftshoe",        XK_masculine,        1 },
  129.     { "lefttack",        XK_Icircumflex,        1 },
  130.     { "less",        XK_less,        0 },
  131.     { "multiply",        XK_paragraph,        1 },
  132.     { "notequal",        XK_acute,        1 },
  133.     { "notgreater",        XK_eth,            1 },
  134.     { "notless",        XK_THORN,        1 },
  135.     { "omega",        XK_copyright,        1 },
  136.     { "overbar",        XK_mu,            1 },
  137.     { "plus",        XK_plus,        0 },
  138.     { "plusminus",        XK_AE,            1 },
  139.     { "quad",        XK_degree,        1 },
  140.     { "quaddivide",        XK_Oacute,        1 },
  141.     { "quadjot",        XK_Ediaeresis,        1 },
  142.     { "quadquote",        XK_uacute,        1 },
  143.     { "quadslope",        XK_oacute,        1 },
  144.     { "query",        XK_question,        0 },
  145.     { "quote",        XK_apostrophe,        0 },
  146.     { "quotedot",        XK_ucircumflex,        1 },
  147.     { "rho",        XK_periodcentered,    1 },
  148.     { "rightarrow",        XK_plusminus,        1 },
  149.     { "rightbracket",     XK_diaeresis,        1 },
  150.     { "rightparen",        XK_parenright,        0 },
  151.     { "rightshoe",        XK_ordfeminine,        1 },
  152.     { "righttack",        XK_Idiaeresis,        1 },
  153.     { "semicolon",        XK_semicolon,        0 },
  154.     { "slash",        XK_slash,        0 },
  155.     { "slashbar",        XK_twosuperior,        1 },
  156.     { "slope",        XK_onequarter,        1 },
  157.     { "slopebar",        XK_Ocircumflex,        1 },
  158.     { "slopequad",        XK_oacute,        1 },
  159.     { "splat",        XK_ae,            1 },
  160.     { "squad",        XK_odiaeresis,        1 },
  161.     { "star",        XK_asterisk,        0 },
  162.     { "stile",        XK_multiply,        1 },
  163.     { "tilde",        XK_Ooblique,        1 },
  164.     { "times",        XK_paragraph,        1 },
  165.     { "underbar",        XK_underscore,        0 },
  166.     { "uparrow",        XK_guillemotleft,    1 },
  167.     { "upcaret",        XK_Eacute,        1 },
  168.     { "upcarettilde",    XK_hyphen,        1 },
  169.     { "upshoe",        XK_exclamdown,        1 },
  170.     { "upshoejot",        XK_ydiaeresis,        1 },
  171.     { "upstile",        XK_yacute,        1 },
  172.     { "uptack",        XK_macron,        1 },
  173.     { "uptackjot",        XK_Otilde,        1 },
  174.     { 0, 0 }
  175. };
  176.  
  177. /*
  178.  * Translation from APL ksysym names to indirect APL keysyms.
  179.  */
  180. KeySym
  181. APLStringToKeysym(char *s, int *is_gep)
  182. {
  183.     register int i;
  184.  
  185.     if (strncmp(s, "apl_", 4))
  186.         return NoSymbol;
  187.     s += 4;
  188.     for (i = 0; axl[i].name; i++)
  189.         if (!strcmp(axl[i].name, s)) {
  190.             *is_gep = axl[i].is_ge;
  191.             return axl[i].keysym;
  192.         }
  193.     return NoSymbol;
  194. }
  195.  
  196. #endif /*]*/
  197.